LIB_PATH=../build/libs

INCL := -I../threadpool/
LIB:= -L$(LIB_PATH) -lthreadpool -lpthread

CFLAGS+=$(INCL) $(LIB)

SOURCE_PATH=.
BUILD_PATH=.

SOURCE := $(wildcard $(SOURCE_PATH)/*.c)
OBJS := $(patsubst %.c, $(BUILD_PATH)/%.o, $(notdir $(SOURCE)))

EXC_S=s
EXC_A=a

all:$(EXC_S) $(EXC_A)

#生成二进制文件(*.o)	
$(OBJS): $(BUILD_PATH)/%.o:$(SOURCE_PATH)/%.c
# $(CC) -c $(CFLAGS) $< -fPIC -o $@
	$(CC) -c $(CFLAGS) $< -o $@

$(EXC_S):$(OBJS)
	$(CC)  $(OBJS) -Wl,-rpath,$(LIB_PATH) -fPIC -o $(EXC_S) $(CFLAGS)

$(EXC_A):$(OBJS)
	$(CC)  $(OBJS) -static -o $(EXC_A) $(CFLAGS)

clean:
	rm -rf *.o $(EXC_S) $(EXC_A)

.PHONY: all clean